// Code scaffolded by goctl. Safe to edit.
// goctl 1.9.1

package user

import (
	"audio-server/internal/result"
	"net/http"

	"audio-server/internal/logic/user"
	"audio-server/internal/svc"

	"github.com/zeromicro/go-zero/rest/httpx"
)

func IndexHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := user.NewIndexLogic(r.Context(), svcCtx)
		_, err := l.Index()
		if err != nil {
			httpx.OkJsonCtx(r.Context(), w, result.Fail(err.Error()))
		} else {
			httpx.OkJsonCtx(r.Context(), w, result.Success("欢迎访问后台"))
		}
	}
}
